package com.yi.mall.order.controller;

import com.yi.mall.common.model.OrderInfo;
import com.yi.mall.common.utils.ResponseEnum;
import com.yi.mall.common.utils.Result;
import com.yi.mall.order.service.impl.OrderInfoServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 订单表 前端控制器
 * </p>
 *
 * @author zzy
 * @since 2025-07-28
 */
@RestController
@RequestMapping("/orderInfo")
public class OrderInfoController {
    @Autowired
    private OrderInfoServiceImpl orderInfoService;
    /**
     * 修改订单
     * @param orderInfo
     * @return
     */
    @PutMapping("/update")
    public Result update(@RequestBody OrderInfo orderInfo){
        orderInfoService.updateById(orderInfo);
        return Result.success(ResponseEnum.SUCCESS);
    }
    /**
     * 查询订单
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public Result getById(@PathVariable String id){
        OrderInfo orderInfo = orderInfoService.getById(id);
        return Result.success(ResponseEnum.SUCCESS, orderInfo);
    }
}
